Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
What is the use of ("*") in jquery

I am reading jQuery, i don't know why use ("*") please explain it's helpful

<script>
    $(document).ready(function(){
        $("button").click(function(){
            $("*").hide();
        });
    });
</script>
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

* is a selector in jquery which select everything without any condition including html, head and body.

Here is an example explaining its usage.

$(document).ready(function(){
    $("button").click(function(){
        $("*").hide();
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
  Hello text
</div>
<button>Click Me to Hide everything</button>
* selector can be used with elements that it selects all child elements within the specified element. without any condition

$(document).ready(function(){
    $("button").click(function(){
        $("div *").toggle();
    });
});
div{
border:0.5px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
  <p>Hello text</p>
  <a>Here is a link </a>
</div>

<button>Click Me to Hide/ Show elements inside the div</button>

over 4 years ago · Santiago Trujillo Report

0

$(*) is used to select all elements inside the document. Refer this: https://www.w3schools.com/jquery/sel_all.asp

over 4 years ago · Santiago Trujillo Report

0

$(*) is a selector in jqueryto select all elements

and hence

$("*").hide(); will hide all elements

$(document).ready(function(){
    $("button").click(function(){
        $("*").hide();
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Hello</div>
<p>World</p>
<span>Good Morning</span>
<button>Hide</button>

Docs

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!